﻿using Microsoft.AspNetCore.Mvc;
using SMes.DbMethod.ViewModel;
using VolPro.Core.Middleware;
using VolPro.Core.Utilities;

namespace VolPro.WebApi.Controllers.IotAPI
{
    /// <summary>
    /// API接受iot的数据，将数据进行处理。。。。
    /// </summary>
    //[AllowAnonymous]
    [ApiController]
    [Route("APi/Iot/SendEquipmentDataToMes")]
    public class IotAPIController : Controller
    {
        /// <summary>
        /// 故障数据-故障处理
        /// </summary>
        /// <param name="dataApiViewModel">api数据</param>
        /// <returns>响应的结果</returns>
        [ActionLog("IOT故障处理")]
        [HttpPost("EquipmentFault")]
        [ApiExplorerSettings(GroupName = "v2")]
        public IActionResult EquipmentFault([FromBody] IotDataApiViewModel dataApiViewModel)
        {
            ///业务处理---数据库增删改
            WebResponseContent webResponseContent = new WebResponseContent();
            webResponseContent.OK("success");
            return Json(webResponseContent) ;
        }

        [ActionLog("IOT设备状态")]
        [HttpPost("EquipmentStatus")]
        [ApiExplorerSettings(GroupName = "v2")]
        public IActionResult EquipmentStatus([FromBody] IotDataApiViewModel dataApiViewModel)
        {
            ///业务处理---数据库增删改
            WebResponseContent webResponseContent = new WebResponseContent();
            webResponseContent.OK("success");
            return Json(webResponseContent);
        }

        [ActionLog("IOT设备相关数据")]
        [HttpPost("EquipmentData")]
        [ApiExplorerSettings(GroupName = "v2")]
        public IActionResult EquipmentData([FromBody] IotDataApiViewModel dataApiViewModel)
        {
            ///业务处理---数据库增删改
            WebResponseContent webResponseContent = new WebResponseContent();
            webResponseContent.OK("success");
            return Json(webResponseContent);
        }
        /// <summary>
        /// 暂时不处理
        /// </summary>
        [ActionLog("IOT能耗数据")]
        [HttpPost("EnergyConsumptionData")]
        [ApiExplorerSettings(GroupName = "v2")]
        public IActionResult EnergyConsumptionData([FromBody] IotDataApiViewModel dataApiViewModel)
        {
            ///业务处理---数据库增删改
            WebResponseContent webResponseContent = new WebResponseContent();
            webResponseContent.OK("success");
            return Json(webResponseContent);
        }
        [ActionLog("IOT工艺数据")]
        [HttpPost("ProcessData")]
        [ApiExplorerSettings(GroupName = "v2")]
        public IActionResult ProcessData([FromBody] IotDataApiViewModel dataApiViewModel)
        {
            ///业务处理---数据库增删改
            WebResponseContent webResponseContent = new WebResponseContent();
            webResponseContent.OK("success");
            return Json(webResponseContent);
        }
        [ActionLog("IOT质量数据")]
        [HttpPost("QualityData")]
        [ApiExplorerSettings(GroupName = "v2")]
        public IActionResult QualityData([FromBody] IotDataApiViewModel dataApiViewModel)
        {
            ///业务处理---数据库增删改
            WebResponseContent webResponseContent = new();
            webResponseContent.OK("success");
            return Json(webResponseContent);
        }
        [ActionLog("IOT报工数据")]
        [HttpPost("CirculationReportData")]
        [ApiExplorerSettings(GroupName = "v2")]
        public IActionResult CirculationReportData([FromBody] IotDataApiViewModel dataApiViewModel)
        {
            ///业务处理---数据库增删改
            WebResponseContent webResponseContent = new WebResponseContent();
            webResponseContent.OK("success");
            return Json(webResponseContent);
        }
    }
}
